#ifndef TEXTSCROLLBAR_H_
#define TEXTSCROLLBAR_H_

#include "../Widget.h"
#include "TextScrollBarElement.h"
#include "../../gui/listeners/TextDownButtonListener.h"
#include "../../gui/listeners/TextUpButtonListener.h"
#include "Button.h"
#include "../../persistencia/Persistor.h"
#include <list>
#include <iostream>

class TextScrollBar: public Widget {
public:
	TextScrollBar(int posX, int posY, Widget *parent,
			std::list<std::string> textElements,SDL_Surface* surface);

	virtual void handleEvent(Event event);

	virtual void resolve();

	virtual void showOn(SDL_Surface* surface);

	virtual ~TextScrollBar();

	void appendElement(std::string name);

	bool deleteSelectedElement();

	std::string getFocusedText();

private:
	Button* upButton;
	Button* downButton;
	SDL_Surface* background;
	std::list<TextScrollBarElement*> scrollBarElements;
	std::list<TextScrollBarElement*>::iterator it_element;

	TextScrollBarElement* focused;

	void createTextScrollBarElements(std::list<std::string> scenarios);

	void updatePositions();
	bool deleteElement(std::string name);

};

#endif /* TEXTSCROLLBAR_H_ */
